<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ post.title }}</title>
    <style>
        /* 全局样式 */
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f4f4f4;
            color: #333;
        }

        /* 导航栏样式 */
        nav {
            display: flex;
            justify-content: space-between;
            align-items: center;
            background-color: #333;
            color: white;
            padding: 1rem 2rem;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        .logo {
            font-size: 1.5rem;
            font-weight: bold;
        }

        .nav-links {
            display: flex;
            list-style: none;
            margin: 0;
            padding: 0;
        }

        .nav-links li {
            margin-left: 1.5rem;
        }

        .nav-links a {
            color: white;
            text-decoration: none;
            transition: color 0.3s ease;
        }

        .nav-links a:hover {
            color: #ffc107;
        }

        .burger {
            display: none;
            cursor: pointer;
        }

        .burger div {
            width: 25px;
            height: 3px;
            background-color: white;
            margin: 5px;
            transition: all 0.3s ease;
        }

        /* 文章内容容器样式 */
        .post-container {
            max-width: 800px;
            margin: 2rem auto;
            background-color: white;
            padding: 2rem;
            border-radius: 5px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        .post-title {
            font-size: 2.5rem;
            margin-bottom: 0.5rem;
        }

        .post-meta {
            font-size: 0.9rem;
            color: #777;
            margin-bottom: 1.5rem;
        }

        .post-image {
            width: 100%;
            height: auto;
            margin-bottom: 1.5rem;
            border-radius: 5px;
        }

        .post-content {
            line-height: 1.6;
        }

        /* 返回首页按钮样式 */
        .back-to-home {
            display: inline-block;
            margin-top: 2rem;
            background-color: #333;
            color: white;
            padding: 0.8rem 1.5rem;
            text-decoration: none;
            border-radius: 5px;
            transition: background-color 0.3s ease;
        }

        .back-to-home:hover {
            background-color: #555;
        }

        /* 响应式设计 */
        @media screen and (max-width: 768px) {
            .nav-links {
                position: absolute;
                right: 0px;
                height: 92vh;
                top: 8vh;
                background-color: #333;
                display: flex;
                flex-direction: column;
                align-items: center;
                width: 50%;
                transform: translateX(100%);
                transition: transform 0.5s ease-in;
            }

            .nav-links li {
                opacity: 0;
            }

            .burger {
                display: block;
            }

            .nav-active {
                transform: translateX(0%);
            }

            .post-container {
                margin: 1rem;
                padding: 1.5rem;
            }
        }

        @keyframes navLinkFade {
            from {
                opacity: 0;
                transform: translateX(50px);
            }
            to {
                opacity: 1;
                transform: translateX(0px);
            }
        }

        .toggle .line1 {
            transform: rotate(-45deg) translate(-5px, 6px);
        }

        .toggle .line2 {
            opacity: 0;
        }

        .toggle .line3 {
            transform: rotate(45deg) translate(-5px, -6px);
        }
    </style>
</head>

<body>
    <!-- 导航栏 -->
    <nav>
        <div class="logo">我的博客</div>
        <ul class="nav-links">
            <li><a href="#">首页</a></li>
            <li><a href="#">文章分类</a></li>
            <li><a href="#">关于我</a></li>
            <li><a href="#">联系我</a></li>
        </ul>
        <div class="burger">
            <div class="line1"></div>
            <div class="line2"></div>
            <div class="line3"></div>
        </div>
    </nav>

    <!-- 文章内容区域 -->
    <div class="post-container">
        <h1 class="post-title">{{ post.title }}</h1>
        <p class="post-meta">作者: {{ post.author }} | 发布时间: {{ post.date }}</p>
        <img class="post-image" src="{{ post.image }}" alt="文章配图">
        <div class="post-content">
            <p>{{ post.content }}</p>
        </div>
        <a href="{{ url_for('index') }}" class="back-to-home">返回首页</a>
    </div>

    <script>
        // 导航栏响应式菜单
        const navSlide = () => {
            const burger = document.querySelector('.burger');
            const nav = document.querySelector('.nav-links');
            const navLinks = document.querySelectorAll('.nav-links li');

            burger.addEventListener('click', () => {
                // 切换导航栏显示状态
                nav.classList.toggle('nav-active');

                // 动画效果
                navLinks.forEach((link, index) => {
                    if (link.style.animation) {
                        link.style.animation = '';
                    } else {
                        link.style.animation = `navLinkFade 0.5s ease forwards ${index / 7 + 0.3}s`;
                    }
                });

                // 汉堡菜单动画
                burger.classList.toggle('toggle');
            });
        };

        navSlide();
    </script>
</body>

</html>
